package com.huadao.cart_ccs.data.source.http;

import com.huadao.cart_ccs.data.bean.DeviceInfo;
import com.huadao.cart_ccs.data.bean.Dispensing;
import com.huadao.cart_ccs.data.bean.EnvironmentLog;
import com.huadao.cart_ccs.data.bean.Project;
import com.huadao.cart_ccs.data.bo.DeviceBO;
import com.huadao.cart_ccs.data.bo.OperationLogBO;
import com.huadao.cart_ccs.data.bo.User;
import com.huadao.cart_ccs.experiment.paramsSetting.ParamConsts;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface Api {
    @FormUrlEncoded
    @POST("TestServlet")
    Observable<BaseResponse<User>> login(@Field("username") String username, @Field("password") String password);

    @POST("api/DeviceInfo/CreateAsync")
    Observable<BaseResponse<DeviceInfo>> createDevice(@Body DeviceInfo deviceInfo);

    @GET("api/DeviceInfo/GetAsync/{id}")
    Observable<BaseResponse<DeviceInfo>> getDeviceById(@Path("id") String id);

    @GET("api/Project/GetProjectByDevid/GetProjectByDevid")
    Observable<BaseResponse<Project>> getProjectByDevid(@Query("devId") String devId,@Query("logincode") String logincode);

    //开启项目
    @GET("api/Project/OpenProject/OpenProject")
    Observable<BaseResponse<Boolean>> openProject(@Query("projectId") String projectId);

//    //完成项目
//    @GET("/api/Project/Complete/Complete")
//    Observable<BaseResponse> completeProject(@Query("projectId") String projectId);

    //罐装完成
    @GET("api/Project/IntoComplete/IntoComplete")
    Observable<BaseResponse<Boolean>> completeReclaim(@Query("projectId") String projectId);

    @POST("api/DeviceRuntimeLog/CreateAsync")
    Observable<BaseResponse<EnvironmentLog>> createEnvirmentLog(@Body EnvironmentLog environmentLog);

//    @GET("api/Dispensing/QueryAsync/Query")
    @GET("api/Dispensing/GetDispensingByDev")
    Observable<BaseResponse<List<Dispensing>>> queryDispensing(@Query("projectId") String projectId, @Query("isUse") Boolean isUse,@Query("keyword") String keyword);

    @POST("api/OperationLog/CreateAsync")
    Observable<BaseResponse<OperationLogBO>> createOperationLog(@Body OperationLogBO operationLog);

}
